#region Using Directives
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using System.Reflection;
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics;
using System.Globalization;
using System.Reflection.Emit;
#endregion Using Directives

namespace Minimal.Web
{
    public partial class QueryString
    {
        /// <summary>
        /// Handles query string parameters that are represented
        /// by properties.
        /// </summary>
        private class PropertyParameterHandler
            : ParameterHandler
        {
            private PropertyInfo propertyInfo;
            private delegate object GetMemberValueDelegate(object o);

            public PropertyParameterHandler(QueryStringParameterAttribute attribute, PropertyInfo i)
                : base(attribute, i)
            {
                this.propertyInfo = i;

                Type[] setValueArguments = new Type[0];
                DynamicMethod dynamicGetValue = new DynamicMethod(
                    "SetValue", i.PropertyType, setValueArguments,
                    typeof(QueryString).Module);
                ILGenerator g = dynamicGetValue.GetILGenerator();
                
                
            }

            protected override object GetMemberValue(object o)
            {
                return this.propertyInfo.GetValue(o, null);
            }

            protected override void SetMemberValue(object o, object value)
            {
                this.propertyInfo.SetValue(o, value, null);
            }

            protected override Type GetMemberType(MemberInfo i)
            {
                return ((PropertyInfo)i).PropertyType;
            }
        }
    }
}
